using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace MCMLXVII.Tools.OrganizationChart.SmartEditors
{


    public partial class ucSmartBaseEditor : UserControl
    {
        protected event EventHandler CancelRequested;
        protected event EventHandler SaveRequested;
        public virtual event EventHandler<MemberUpdatedEventsArgs> MemberUpdated;
        public virtual event EventHandler<MemberUpdatedEventsArgs> EditorClosed;
        public virtual int NodeID
        { get { return 0; } }

        public ucSmartBaseEditor()
        {
            InitializeComponent();
            btnOK.Enabled = false;
        }

        public void RelocateButtons( int Top)
        {
            btnCancel.Top = Top+20;
            btnOK.Top = Top+20;
        }
        protected void EnableUpdate()
        {
            btnOK.Enabled = true;
        }

        protected void DisableUpdate()
        {
            btnOK.Enabled = false;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {           
            SaveRequested.Invoke(this, null);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            CancelRequested.Invoke(this, null);
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            CancelRequested.Invoke(this, null);
        }

        private void btnClose_Resize(object sender, EventArgs e)
        {
            btnCancel.Left = this.Width - btnCancel.Width - 20;
        }
    }
}
